<template>
	<view class="page">

		<!-- 订单tab -->
		<view class="order-tab">
			<view class="tab" :class="{'action':OrderType==-1}" @click="onOrderTab(-1)">
				<text>全部</text>
				<text class="line"></text>
			</view>
			<view class="tab" :class="{'action':OrderType==1}" @click="onOrderTab(1)" v-if="!quertList['store_id']">
				<text>鉴定中</text>
				<text class="line"></text>
			</view>
			<view class="tab" :class="{'action':OrderType==1}" @click="onOrderTab(1)" v-if="quertList['store_id']">
				<text>待鉴定</text>
				<text class="line"></text>
			</view>
			<view class="tab" :class="{'action':OrderType==2}" @click="onOrderTab(2)">
				<text>已完成</text>
				<text class="line"></text>
			</view>

		</view>
		<!-- 订单列表 -->
		<view class="order-list">
			<view class="list" v-for="(item,index) in list" @click="onOrderList(item)" :key="index">
				<view class="title-status">
					<view class="title">
						<text>下单时间：{{item.create_time}}</text>
					</view>
					<view class="status" v-if="quertList['store_id']">
						<text v-if="item.status==1">待鉴定</text>
						<text v-if="item.status==2">已完成</text>
						<text class="iconfont icon-laji del"></text>
					</view>
					<view class="status" v-else>
						<text v-if="item.status==1">鉴定中</text>
						<text v-if="item.status==2">已完成</text>
						<text class="iconfont icon-laji del"></text>
					</view>
				</view>
				<view class="goods-list">
					<view class="goods">
						<view class="thumb">
							<image :src="item.img_list[0]" mode=""></image>
						</view>
						
					</view>
				</view>
				<view class="status-btn">
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
		import {
			getOrderAppariser
		} from '@/config/api.js';
	export default {
		data() {
			return {
				OrderType: null,
				list:[],
				quertList: {
					page:1,
					limit: 20,
					status: null,
				}
			};
		},
		onLoad(params) {
			if(params.store_id){
				this.quertList['store_id'] = params.store_id;
				this.quertList['nav_id'] = uni.getStorageSync('pathNavId');;
				
			}
			this.getList();
			uni.setStorageSync('order_info','');
		},
		methods: {
			/**
			 * 返回点击
			 */
			getList(){
				getOrderAppariser(this.quertList).then(res => {
					this.list = res.data;
				})
			},
			onBack() {
				uni.navigateBack();
			},
			/**
			 * 订单tab点击
			 */
			onOrderTab(type) {
				if(type == -1)type = null;
				this.quertList.status = type;
				this.OrderType = type;
				this.getList();
				// #ifdef H5
				uni.redirectTo({
					url: '/pages/MyOrderList/MyOrderList?type=' + type,
				})
				//#endif
			},
			/**
			 * 订单列表点击
			 */
			onOrderList(data) {
				uni.setStorageSync('order_info',data);
				let urlpath = '/moduleD/jianDing/OrderDetails/OrderDetails';
				if(this.quertList['store_id']){
					urlpath += '?store_id='+this.quertList['store_id'];
				}
				uni.navigateTo({
					url: urlpath,
				})
			},
			/**
			 * 评价点击
			 */
			onEvaluate() {
				uni.navigateTo({
					url: '/pages/MyEvaluatePush/MyEvaluatePush'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import 'jianDing.scss';
</style>